package com.chaoxing.controller;

import com.chaoxing.entity.Teacher;
import com.chaoxing.service.TeacherService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class TeacherController {

    @Resource
    private TeacherService teacherService;

    @RequestMapping("/search.do")
    public Map<String, List<Teacher>> searchTeacher(){
        Map<String, List<Teacher>> map = new HashMap<>();
        List<Teacher> teachers = teacherService.searchTeacher();
        if(teachers.size() > 0){
            map.put("resp",teachers);
            return map;
        }
        map.put("errMsg",null);
        return map;
    }
}
